Micron Document
🎖️GitЯра🎖️

Node / meshtastic / Meshtastic-Android / files / core / ui / src / commonMain / kotlin / org / meshtastic / core / ui / viewmodel / ConnectionsViewModel.kt

Displaying Raw • Download

core/ui/src/commonMain/kotlin/org/meshtastic/core/ui/viewmodel/ConnectionsViewModel.kt 520fa717a938fd84682403b41f57d9f7e1ef49ef (520fa717) Text, 3.34 KB

T8b949e/*
* Copyright (c) 2025-2026 Meshtastic LLC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
Tff7b72package T7ee787org.meshtastic.core.ui.viewmodel

Tff7b72import T7ee787androidx.lifecycle.ViewModel
Tff7b72import T7ee787kotlinx.coroutines.flow.MutableStateFlow
Tff7b72import T7ee787kotlinx.coroutines.flow.StateFlow
Tff7b72import T7ee787kotlinx.coroutines.flow.asStateFlow
Tff7b72import T7ee787kotlinx.coroutines.flow.distinctUntilChanged
Tff7b72import T7ee787kotlinx.coroutines.flow.map
Tff7b72import T7ee787org.koin.core.annotation.KoinViewModel
Tff7b72import T7ee787org.meshtastic.core.model.MyNodeInfo
Tff7b72import T7ee787org.meshtastic.core.model.Node
Tff7b72import T7ee787org.meshtastic.core.repository.NodeRepository
Tff7b72import T7ee787org.meshtastic.core.repository.RadioConfigRepository
Tff7b72import T7ee787org.meshtastic.core.repository.ServiceRepository
Tff7b72import T7ee787org.meshtastic.core.repository.UiPrefs
Tff7b72import T7ee787org.meshtastic.proto.Config
Tff7b72import T7ee787org.meshtastic.proto.LocalConfig

Tf0883e@KoinViewModel
Tff7b72class T56d364ConnectionsViewModelTb4b4b4(
Te6edf3radioConfigRepositoryTb4b4b4: Te6edf3RadioConfigRepositoryTb4b4b4,
Te6edf3serviceRepositoryTb4b4b4: Te6edf3ServiceRepositoryTb4b4b4,
Te6edf3nodeRepositoryTb4b4b4: Te6edf3NodeRepositoryTb4b4b4,
Tff7b72private Tff7b72val Te6edf3uiPrefsTb4b4b4: Te6edf3UiPrefsTb4b4b4,
Tb4b4b4) Tb4b4b4: Te6edf3ViewModelTb4b4b4(Tb4b4b4) Tb4b4b4{

Tff7b72val Te6edf3localConfigTb4b4b4: Te6edf3StateFlowTff7b72<Te6edf3LocalConfigTff7b72> Tff7b72=
Te6edf3radioConfigRepositoryTb4b4b4.Te6edf3localConfigFlowTb4b4b4.Te6edf3stateInWhileSubscribedTb4b4b4(Te6edf3initialValue Tff7b72= Te6edf3LocalConfigTb4b4b4(Tb4b4b4)Tb4b4b4)

Tff7b72val Te6edf3connectionState Tff7b72= Te6edf3serviceRepositoryTb4b4b4.Te6edf3connectionState

Tff7b72val Te6edf3myNodeInfoTb4b4b4: Te6edf3StateFlowTff7b72<Te6edf3MyNodeInfo?Tff7b72> Tff7b72= Te6edf3nodeRepositoryTb4b4b4.Te6edf3myNodeInfo

Tff7b72val Te6edf3ourNodeInfoTb4b4b4: Te6edf3StateFlowTff7b72<Te6edf3Node?Tff7b72> Tff7b72= Te6edf3nodeRepositoryTb4b4b4.Te6edf3ourNodeInfo

T8b949e/**
* Filtered [ourNodeInfo] that only emits when display-relevant fields change, preventing continuous recomposition
* from lastHeard/snr updates.
*/
Tff7b72val Te6edf3ourNodeForDisplayTb4b4b4: Te6edf3StateFlowTff7b72<Te6edf3Node?Tff7b72> Tff7b72=
Te6edf3nodeRepositoryTb4b4b4.Te6edf3ourNodeInfo
Tb4b4b4.Te6edf3distinctUntilChanged Tb4b4b4{ Te6edf3oldTb4b4b4, Te6edf3new Tff7b72-Tff7b72>
Te6edf3oldTff7b72?.Te6edf3num Tff7b72=Tff7b72= Te6edf3newTff7b72?.Te6edf3num Tff7b72&Tff7b72&
Te6edf3oldTff7b72?.Te6edf3user Tff7b72=Tff7b72= Te6edf3newTff7b72?.Te6edf3user Tff7b72&Tff7b72&
Te6edf3oldTff7b72?.Te6edf3batteryLevel Tff7b72=Tff7b72= Te6edf3newTff7b72?.Te6edf3batteryLevel Tff7b72&Tff7b72&
Te6edf3oldTff7b72?.Te6edf3voltage Tff7b72=Tff7b72= Te6edf3newTff7b72?.Te6edf3voltage Tff7b72&Tff7b72&
Te6edf3oldTff7b72?.Te6edf3metadataTff7b72?.Te6edf3firmware_version Tff7b72=Tff7b72= Te6edf3newTff7b72?.Te6edf3metadataTff7b72?.Te6edf3firmware_version
Tb4b4b4}
Tb4b4b4.Te6edf3stateInWhileSubscribedTb4b4b4(Te6edf3initialValue Tff7b72= Te6edf3nodeRepositoryTb4b4b4.Te6edf3ourNodeInfoTb4b4b4.Te6edf3valueTb4b4b4)

T8b949e/** Whether the LoRa region is UNSET and needs to be configured. */
Tff7b72val Te6edf3regionUnsetTb4b4b4: Te6edf3StateFlowTff7b72<Tffa657BooleanTff7b72> Tff7b72=
Te6edf3radioConfigRepositoryTb4b4b4.Te6edf3localConfigFlow
Tb4b4b4.Te6edf3map Tb4b4b4{ Tffa657itTb4b4b4.Te6edf3loraTff7b72?.Te6edf3region Tff7b72=Tff7b72= Te6edf3ConfigTb4b4b4.Te6edf3LoRaConfigTb4b4b4.Te6edf3RegionCodeTb4b4b4.Te6edf3UNSET Tb4b4b4}
Tb4b4b4.Te6edf3distinctUntilChangedTb4b4b4(Tb4b4b4)
Tb4b4b4.Te6edf3stateInWhileSubscribedTb4b4b4(Te6edf3initialValue Tff7b72= Tff7b72falseTb4b4b4)

Tff7b72private Tff7b72val Te6edf3_hasShownNotPairedWarning Tff7b72= Te6edf3MutableStateFlowTb4b4b4(Te6edf3uiPrefsTb4b4b4.Te6edf3hasShownNotPairedWarningTb4b4b4.Te6edf3valueTb4b4b4)
Tff7b72val Te6edf3hasShownNotPairedWarningTb4b4b4: Te6edf3StateFlowTff7b72<Tffa657BooleanTff7b72> Tff7b72= Te6edf3_hasShownNotPairedWarningTb4b4b4.Te6edf3asStateFlowTb4b4b4(Tb4b4b4)

Tff7b72fun Td2a8ffsuppressNoPairedWarningTb4b4b4(Tb4b4b4) Tb4b4b4{
Te6edf3_hasShownNotPairedWarningTb4b4b4.Te6edf3value Tff7b72= Tff7b72true
Te6edf3uiPrefsTb4b4b4.Te6edf3setHasShownNotPairedWarningTb4b4b4(Tff7b72trueTb4b4b4)
Tb4b4b4}
Tb4b4b4}

Served by rngit 1.5.0 - Generated in 0.04s